package com.hsbc.superBank.executing.modules.sys.dao.impl;


import com.hsbc.superBank.executing.common.dao.BaseDao;
import com.hsbc.superBank.executing.modules.sys.dao.AccountDao;
import com.hsbc.superBank.executing.modules.sys.entity.Account;

public class AccountDaoImpl extends BaseDao<Account> implements AccountDao {

	@Override
	public Account get(Integer accountId) {
		String sql = "SELECT accountId, balance FROM account WHERE accountId = ?";
		return query(sql, accountId); 
	}

	@Override
	public void updateBalance(Integer accountId, float amount) {
		String sql = "UPDATE account SET balance = balance - ? WHERE accountId = ?";
		update(sql, amount, accountId); 
	}

}
